﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ElectricalTest
{
    public partial class UpdateForm : Form
    {
        public delegate void UpdateDataDele(string[] str);
        public event UpdateDataDele UpdateEvent;

        public UpdateForm(string[] str,DataGridViewRow dgvrc)
        {
            InitializeComponent();

            for (int i = 0; i < str.Length; i++)
            {
                comboBox1.Items.Add(str[i]);
            }

            comboBox2.Items.Add("前排");
            comboBox2.Items.Add("中排");
            comboBox2.Items.Add("后排");


            comboBox1.Text = dgvrc.Cells[0].Value.ToString();
            comboBox2.Text = dgvrc.Cells[1].Value.ToString();

            textBox1.Text = dgvrc.Cells[2].Value.ToString();
            textBox2.Text = dgvrc.Cells[3].Value.ToString();
            textBox3.Text = dgvrc.Cells[4].Value.ToString();
            textBox4.Text = dgvrc.Cells[5].Value.ToString();
            textBox5.Text = dgvrc.Cells[6].Value.ToString();
            textBox6.Text = dgvrc.Cells[7].Value.ToString();

            checkBox1.Checked = Convert.ToBoolean(dgvrc.Cells[8].Value.ToString());
            checkBox2.Checked = Convert.ToBoolean(dgvrc.Cells[9].Value.ToString());
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string[] tempStr={comboBox1.Text,comboBox2.Text,textBox1.Text,textBox2.Text,textBox3.Text,textBox4.Text,textBox5.Text,textBox6.Text,checkBox1.Checked.ToString(),checkBox2.Checked.ToString()};
            UpdateEvent(tempStr);
        }
    }
}
